package org.jeecg.entity.car;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.enums.car.CarSyncStatusEnum;
import org.jeecg.modules.system.entity.BaseEntity;
import org.jeecg.modules.system.entity.SysSmsConfig;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Description: 车辆列表
 * @Author: jeecg-boot
 * @Date:   2019-07-10
 * @Version: V1.0
 */
@Data
@TableName("car_info")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="car_info对象", description="车辆列表")
public class CarInfo extends BaseEntity {
    
	/**记录id*/
	@TableId(type = IdType.ID_WORKER_STR)
    @ApiModelProperty(value = "记录id")
	private String id;

	/**物业公司id*/
	@ApiModelProperty(value = "物业公司id")
	private String tenantId;

	/**社区id*/
    @ApiModelProperty(value = "社区")
	private String projectId;

	@Excel(name = "项目名称", width = 15)
	@TableField(exist = false)
	private String projectName;

	private String floorId;

	@Excel(name = "楼栋", width = 15)
	private String floorName;

	/**房间id*/
    @ApiModelProperty(value = "房间")
//	@Dict(dicCode = "id",dictTable = "base_room",dicText = "name")
	private String roomId;

	@Excel(name = "房间", width = 20)
	private String roomName;

	/**绑定业主或租户id*/
	@ApiModelProperty(value = "绑定用户")
	private String ownerId;

	private Integer isOwner;

	@Excel(name = "用户类型", width = 15)
	@TableField(exist = false)
	private String isOwnerName;

	@Excel(name = "用户名称", width = 15)
	private String ownerName;

	/**车场id*/
    @ApiModelProperty(value = "车场id")
	private String parkId;

    @ApiModelProperty(value = "外部车场id")
	@TableField(exist = false)
    private String outParkId;

	@Excel(name = "车场", width = 15)
	@TableField(exist = false)
	private String parkName;

	@ApiModelProperty(value = "车型 1：小客车 2：大客车 3：货车 4：特种车")
	private String carModel;

	@Excel(name = "车辆类型",width = 15)
	@TableField(exist = false)
	private String carModelName;

	@ApiModelProperty(value = "外部车型id")
	@TableField(exist = false)
	private String outCarModel;

	@ApiModelProperty(value = "车类 1:产权车  2:月卡车  3:贵宾车 4:临停车 ")
	private String carType;

	@Excel(name = "车类名称",width = 15)
	@TableField(exist = false)
	private String carTypeName;

	@ApiModelProperty(value = "外部车类id")
	@TableField(exist = false)
	private String outCarType;

	/**电话号码*/
	@Excel(name = "电话号码", width = 15)
    @ApiModelProperty(value = "电话号码")
	private String mobile;
	/**车牌*/
	@Excel(name = "车牌", width = 15)
    @ApiModelProperty(value = "车牌")
	private String carNo;

	@ApiModelProperty(value = "车位号id")
	//@TableField(updateStrategy = FieldStrategy.IGNORED)
	private String carPortId;

	@ApiModelProperty(value = "车位号")
	@TableField(exist = false)
	 @Excel(name = "车位号", width = 15)
	private String carPortNum;

	@ApiModelProperty(value = "身份证号")
	private String idCard;

	@ApiModelProperty(value = "续费规则")
	private String feeRuleId;

	@TableField(exist = false)
	@Excel(name = "月租规则",width = 15)
	private String feeRuleName;

	@ApiModelProperty(value = "起始日")
	@Excel(name = "月租开始日期", width = 15,format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@TableField(updateStrategy = FieldStrategy.IGNORED)
	private Date localStartTime;

	@ApiModelProperty(value = "到期日")
	@Excel(name = "月租截止日期", width = 15,format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@TableField(updateStrategy = FieldStrategy.IGNORED)
	private Date localEndTime;

	@ApiModelProperty(value = "审核状态 -1:审核未通过 0:待审核 1:审核通过")
	private Integer checkStatus;

	@TableField(exist = false)
	@Excel(name = "审核状态", width = 15)
	private String checkStatusName;


	private String images;


	@ApiModelProperty(value = "审核备注")
	@TableField(exist = false)
	private String checkReason;

    @ApiModelProperty(value = "createBy")
	private String createBy;

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @ApiModelProperty(value = "createTime")
	@Excel(name = "录入日期", width = 15,format = "yyyy-MM-dd HH:mm")
	private Date createTime;

    @ApiModelProperty(value = "updateBy")
	private String updateBy;

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "updateTime")
	private Date updateTime;

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
	@ApiModelProperty(value = "审核时间")
	@Excel(name = "审核时间", width = 15,format = "yyyy-MM-dd HH:mm")
	@TableField(exist = false)
	private Date checkTime;

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
	@ApiModelProperty(value = "最后同步时间")
	@TableField(exist = false)
	private Date syncTime;

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "末次缴费时间")
	@Excel(name = "末次缴费时间", width = 15,format = "yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date endChargeTime;

	@ApiModelProperty(value = "预通知短信天数")
	@TableField(exist = false)
	private Integer smsDay;

    @ApiModelProperty(value = "remarks")
	@Excel(name = "备注", width = 15)
	private String remarks;

    @TableLogic
    @ApiModelProperty(value = "delFlag")
	private String delFlag;

    @TableField(exist = false)
	private String address;

    @TableField(exist = false)
    private String projectCode;

    //搜索条件到期日开始时间
    @TableField(exist = false)
    private String startTime;
	//搜索条件到期日结束时间
	@TableField(exist = false)
	private String endTime;
	//关联的收费项id 开票计算税率用
	@TableField(exist = false)
	private String feeitemId;

	@TableField(exist = false)
	private String createName;

	/*车位到期开始时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date portLocalStartTime;

	/*车位到期结束时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date portLocalEndTime;

	/**同步状态(0:未同步  1:已同步)*/
	@ApiModelProperty(value = "同步状态(0:未同步  1:已同步)")
	@Excel(name="同步状态",width=15,replace={"已同步_1","未同步_0"})
	private Integer syncStatus;

	/**车辆状态0启用，1停用*/
	@ApiModelProperty(value = "车辆状态0启用，1停用")
	@Excel(name="车辆状态",width=15,replace={"停用_1","启用_0"})
	private Integer status;

	@ApiModelProperty(value = "ab车状态 0:临停车 1:月租车")
	@TableField(exist = false)
	private Integer abStatus;

	@ApiModelProperty(value = "是否出场 0出场 1入场")
	private Integer isExit;

	@TableField(exist = false)
	SysSmsConfig sysSmsConfig;

	public String getCheckStatusName() {
		if (this.checkStatus != null){
			switch (this.checkStatus){
				case -1:
					checkStatusName = "审核拒绝";
					break;
				case 0:
					checkStatusName = "待审核";
					break;
				case 1:
					checkStatusName = "审核通过";
					break;
			}
		}
		return checkStatusName;
	}
	public String getSyncStatusStr() {
		return CarSyncStatusEnum.getDesc(this.syncStatus);
	}

}
